﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;

namespace GSISW8.Common
{
    public class ActiveConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, string language)
        {
            bool convertOK;

            int x;
            convertOK = Int32.TryParse(value.ToString(), out x);

            if (!convertOK) return "Λάθος δεδομένα";

            if (x == 1) return "ΝΑΙ";
            else return "ΟΧΙ";
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }




     
    }
    public class DateTimeToStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (((DateTime?)value).HasValue)
                return String.Format("{0:dd/MM/yyyy}", (DateTime)value);
            else return string.Empty;
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    } 
}
